<?php
namespace catchAdmin\storehouse\model\search;

trait InventoryOperationRecordSearch
{
    public function searchGoodsNameAttr($query, $value, $data)
    {
        return $query->whereLike('r.goods_name', $value);
    }

    public function searchWarehousingIdAttr($query, $value, $data)
    {
        return $query->whereLike('r.warehousing_id', $value);
    }

    //搜索 托盘 箱号 片号
    public function searchArbitraryCodeAttr($query, $value, $data){
        return $query->where('r.tray_id|r.box_id|r.slice_id','like',"%$value%");
    }

    //搜索操作时间
    public function searchCreatedAtAttr($query, $value, $data)
    {
        $query->whereBetweenTime('r.created_at', $value[0], $value[1]);
    }

    //搜索订单类型
    public function searchOrderTypeAttr($query, $value, $data)
    {
        return $query->where('r.order_type', $value);
    }

    //搜索order_id
    public function searchOrderIdAttr($query, $value, $data)
    {
        return $query->where('r.order_id', $value);
    }

    //搜索order_pid
    public function searchOrderPidAttr($query, $value, $data)
    {
        return $query->where('r.order_pid', $value);
    }

    //搜索id
    public function searchIdAttr($query, $value, $data)
    {
        return $query->where('r.id', $value);
    }
}

